const Mock = require('mockjs')

//按字母a-z的联系人列表
//return [{title: 'letter', items: []}]
const contactList = []
function generateContactsList() {
  for(var i=65;i<91;i++){
    let title = String.fromCharCode(i)
    let items = []

    //随机生成一定数量的联系人
    let counts = Math.floor(Math.random() * 6)
    for(let j = 0; j < counts; j++){
      items.push(Mock.mock({
        'id': '@id',
        'name': '@cname'
      }))
    }

    if(items.length > 0){
      contactList.push({
        title,
        items
      })
    }
  }

  return contactList
}

generateContactsList()

export {
  contactList
}
